package net.sf.jOpinionPoll.dao;

import java.util.List;

import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

import org.springframework.stereotype.Repository;

import net.sf.jOpinionPoll.entity.Cliente;

@Repository
public class TesteDao {

	@PersistenceContext
	private EntityManager em;
	
	public boolean isOk() {
		return em != null;
	}

	@SuppressWarnings("unchecked")
    public List<Cliente> getData() {
        System.out.println("Creating query...");
        List<Cliente> result = null;
        try {
            result = (List<Cliente>)em.createQuery("select e from Cliente e");
        } catch(Throwable e) {
            e.printStackTrace();
        }
        
        return result;
    }
}